package com.laconic.vbenadmin.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.laconic.vbenadmin.SingleResponse;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author JiangLiu
 * @Date 2025/5/24 12:00
 **/
@CrossOrigin
@RestController
@RequestMapping("/api")
public class PermissionController {

    /**
     * 权限接口测试中
     * @param servletRequest
     * @return
     */
//    @GetMapping("/menu/all")
//    public SingleResponse getAllMenu(HttpServletRequest servletRequest) {
//        System.out.println(servletRequest);
//        String s = "[{\"meta\":{\"order\":-1,\"title\":\"page.dashboard.title\"},\"name\":\"Dashboard\",\"path\":\"/\",\"redirect\":\"/analytics\",\"children\":[{\"name\":\"Analytics\",\"path\":\"/analytics\",\"component\":\"/dashboard/analytics/index\",\"meta\":{\"affixTab\":true,\"title\":\"page.dashboard.analytics\"}},{\"name\":\"Workspace\",\"path\":\"/workspace\",\"component\":\"/dashboard/workspace/index\",\"meta\":{\"title\":\"page.dashboard.workspace\"}}]},{\"name\":\"Test\",\"path\":\"/test\",\"component\":\"/test/index\",\"meta\":{\"title\":\"page.test\",\"noBasicLayout\":true}}]";
//        JSONArray array = JSONObject.parseArray(s);
//        System.out.println(array);
//
//        return SingleResponse.success(array);
//    }
}
